﻿Public Class MainPreviewControl
    Dim vFormName As String
    Dim vHeaderTitle As String

    Public Property FormName() As String
        Get
            Return vFormName
        End Get
        Set(ByVal value As String)
            vFormName = value
        End Set
    End Property

    Public Property HeaderTitle() As String
        Get
            Return vHeaderTitle
        End Get
        Set(ByVal value As String)
            vHeaderTitle = value
        End Set
    End Property

    Public Sub MainLoad(ByVal report As DevExpress.XtraReports.UI.XtraReport, ByVal ReportData As DataTable)

        PreviewControl1.report = report
        PreviewControl1.DataSources = ReportData
        PreviewControl1.pre_Report()

    End Sub

    Public Sub MainLoadReport(ByVal ds As DataSet, ByVal noreport As Integer)        
        If noreport = 2 Then
            Dim rptriwayat As New XtraReportRiwayatSiswa            
            rptriwayat.DataSource = ds
            rptriwayat.DataMember = "vriwayatkesehatan"            
            rptriwayat.PrintingSystem = PreviewControl1.PrintingSystem1
            Try
                rptriwayat.CreateDocument()
            Catch ex As Exception
            End Try
        ElseIf noreport = 1 Then
            Dim rptriwayat As New XtraReportKesehatanSiswa
            rptriwayat.DataSource = ds
            rptriwayat.DataMember = "vlapkesehatansiswa"
            rptriwayat.PrintingSystem = PreviewControl1.PrintingSystem1
            Try
                rptriwayat.CreateDocument()
            Catch ex As Exception
            End Try
        Else
            Dim rptriwayat As New rptDATA_SISWA
            rptriwayat.DataSource = ds
            rptriwayat.DataMember = "datasiswa"
            rptriwayat.PrintingSystem = PreviewControl1.PrintingSystem1
            Try
                rptriwayat.CreateDocument()
            Catch ex As Exception
            End Try
        End If
       
    End Sub

    'Public Sub MainLoadRiwayat(ByVal ds As DataSet)
    '    'Dim ColumnNamekey As String
    '    'Dim dtrelation As DataRelation
    '    Dim rptriwayat As New XtraReportRiwayatSiswa
    '    'ColumnNamekey = "nis"
    '    'dtrelation = New DataRelation("relationsisri", ds.Tables("datasiswa").Columns(ColumnNamekey), ds.Tables("riwayatkesehatan").Columns(ColumnNamekey))
    '    rptriwayat.DataSource = ds
    '    rptriwayat.DataMember = "vriwayatkesehatan"
    '    'rptriwayat.DetailReport.DataSource = ds
    '    'rptriwayat.DetailReport.DataMember = "relationsisri"
    '    rptriwayat.PrintingSystem = PreviewControl1.PrintingSystem1
    '    Try
    '        rptriwayat.CreateDocument()
    '    Catch ex As Exception
    '    End Try
    '    'PreviewControl1.DataSourceRiwayat = ds
    '    'PreviewControl1.pre_ReportRiwayat()
    'End Sub

    Private Sub btnBACK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBACK.Click
        BaseMain.SetSelectMenu(FormName, HeaderTitle)
    End Sub
End Class
